using System;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter16
{
	/// <summary>
	/// Example02:  Traveling Sinusoidal Wave
	/// A sinusoidal wave traveling in the positive x direction 
	/// has an amplitude of 15.0 cm, a wavelength of 40.0 cm, and 
	/// a frequency of 8.00 Hz. The vertical position of an element 
	/// of the medium at t = 0 and x = 0 is also 15.0 cm, as shown in 
	/// Figure 16.9.
	/// (A) Find the wave number k, period T, angular frequency \omega, 
	/// and speed v of the wave.
	/// k = 0.157 rad/cm
	/// T = 0.125 s
	/// \omega = 50.3 rad/s
	/// v = 320 cm/s
	/// (B) Determine the phase constant \phi, and write a general 
	/// expression for the wave function.
	/// \phi = 90^{\circle}
	/// y = 15 \cos(0.157 x - 50.3 t)
	/// </summary>
	public class Example02
	{
		public Example02()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			L.SinusoidalWave y = new L.SinusoidalWave();
			y.Amplitude = 0.15;
			y.WaveLength = 0.4;
			y.Frequency = 8.0;
			y.PhaseConstant = Math.Asin(y.Amplitude/0.15);

			//(A)
			y.FindWaveNumberFromWaveLength();
			result+=Convert.ToString(y.WaveNumber)+"\r\n";
			y.FindPeriodFromFrequency();
			result+=Convert.ToString(y.Period)+"\r\n";
			y.FindAngularFrequencyFromFrequency();
			result+=Convert.ToString(y.AngularFrequency)+"\r\n";
			y.FindSpeedFromWaveLengthFrequency();
			result+=Convert.ToString(y.Speed)+"\r\n";
			//(B)
			result+=Convert.ToString(y.PhaseConstant*180/Math.PI)+"\r\n";
		}
	}
}
